package modules::stat_preprocessing;
use modules::utilities;
use Data::Dumper;
sub new {
  my ($class,$config) = @_;
  my $self = {
               _config => $config,
             };
  bless $self,$class;

  return $self;
}

sub read_gtf {
  my ($self) = @_;
  my $path   = $self->{'_config'}{'_path'};
  my ($genes,$transcripts,$exons,$ids);
  my $i = 0;
  
  open (my $fh,'<',$path);
  while(my $line = <$fh>) {
    chomp $line;

# gene_id "ENSGALG00000009771"; transcript_id "ENSGALT00000015891"; exon_number "1"; gene_biotype "protein_coding"; gene_name "ENSGALG00000009771"; p_id "P7090"; tss_id "TSS4398";              
    my ($gene,$transcript,$exon) = ($line =~ /gene_id\s\"(\w+)\".+transcript_id\s\"(\w+)\".+exon_number\s\"(\d+)/);

    $ids->{'gene_id'      }{"$gene"}++;
    $ids->{'exon_number'  }{"$gene$exon"}++;
    $ids->{'transcript_id'}{"$transcript"}++;
  
  }

  print "FILE:$path\n";

  print "genes\t\t"        . scalar keys %{$ids->{'gene_id'      }};
  print "\nexons\t\t"      . scalar keys %{$ids->{'exon_number'  }};
  print "\ntranscripts\t"  . scalar keys %{$ids->{'transcript_id'}};
  return;
}

1;